define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Productmanager_sort,GoPage) {
		
		  //跳转到添加分类页面
		$scope.onshow_edit = function(){
			GoPage.go_states("productmanager_sort_edit");
		}
	   //4个导航
		$scope.onshow_productmanager= function(index){
			if(index==1) GoPage.go_states("productmanager_sale");
			if(index==2) GoPage.go_states("productmanager_brand");
			if(index==3) GoPage.go_states("productmanager_waitsale");
//			if(index==4) GoPage.go_states("productmanager_sort");
		}
		$scope.init_data = function(){
			Productmanager_sort.get_list(function(data){
				$scope.datas = data.custom_cat;
			})
		}
		$scope.selectAll = function(){
			for(var i =0;i<$scope.datas.length;i++){
				$scope.datas[i].checked = true;
			
			}
			console.log($scope.datas);
		}
		$scope.init_data();
		
	}

	controller.$inject = ['$scope', 'Productmanager_sort','GoPage'];
	
	return app.registerController("productmanager_sortctrl",controller);
});